//
//  DJBarDelegate.m
//  FitnessVideo
//
//  Created by tikeios_001 on 2023/5/5.
//

#import "DJBarDelegate.h"


@interface DJBarDelegate() {
    NSArray *hiddenControllers;
    NSArray *hiddenFloatController;
}
@end

@implementation DJBarDelegate
- (instancetype)init {
    if (self = [super init]) {
        hiddenControllers = @[@"QZLoginVC",@"QZMyVC",@"QZTabbarController",@"QZHomeMenceVC",@"QZMyDetailsPlayVC",@"QZFriendVC",@"QZOtherMyVC",@"My_editViewController",@"AgreementViewController",@"DJMYBIVC",@"QZHongBaoDetailsVC",@"DJMyOpenCreatorVC",@"QZMyRightVC",@"QZShortPlayVC",@"QZHomeShortVC"];
    UIButton * textShowButtonTo1 = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
        NSString * textShowButtonTitleTo1 = @"测试功能";
        [textShowButtonTo1 setTitle:textShowButtonTitleTo1 forState:UIControlStateNormal];
        NSInteger textShowArcTo1 = arc4random_uniform(22);
        NSLog(@"随机数：%ld", (long)textShowArcTo1);
    }
    return self;
}

+ (DJBarDelegate *)share {
    static DJBarDelegate *delegate;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        delegate = [[DJBarDelegate alloc] init];
    });
    return delegate;
}

#pragma mark -UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    BOOL navigationBarHidden = NO;
    NSString *viewControllerName = NSStringFromClass([viewController class]);
//    NSLog(@"%@",viewControllerName);
    if ([hiddenControllers containsObject:viewControllerName]) {
        navigationBarHidden = YES;
    }
    if (navigationBarHidden) {
        if (!navigationController.isNavigationBarHidden) {
            [navigationController setNavigationBarHidden:YES animated:animated];
        }
    } else {
        if (navigationController.isNavigationBarHidden) {
            [navigationController setNavigationBarHidden:NO animated:animated];
        }
    }
}

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
   
}

//- (void)hiddenFloatView:(UINavigationController *)navigationController isHidden:(BOOL)isHidden {
//    if (navigationController.DJTabBarController != nil && [navigationController.DJTabBarController isKindOfClass:[DVDJTabBarController class]]) {
////        [((DVDJTabBarController *)navigationController.DJTabBarController) isHiddenFloatView:isHidden];
//    }
//}
@end
